/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Util;

import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToolBar;

/**
 *
 * @author Maryluz
 */
public class JTextNumerico extends JTextField {
    
    public JTextNumerico(String datos) {
        
                
        this.addKeyListener(new KeyAdapter() {
            @Override
            public void keyTyped(KeyEvent e) {
                char caracter = e.getKeyChar();
                // Verificar si la tecla pulsada no es un digito
                if (((caracter < '0') || (caracter > '9')) && (caracter != '\b' /*corresponde a BACK_SPACE*/)) {
                    e.consume();  // ignorar el evento de teclado
                }

            }
        });
        
        oJPanelNumerico.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        oJPanelNumerico.setMinimumSize(new java.awt.Dimension(208, 248));
        oJPanelNumerico.setPreferredSize(new java.awt.Dimension(208, 248));
        oJPanelNumerico.setLayout(new java.awt.BorderLayout());
        // JToolBar_01
        oBar1.setFloatable(false);
        oBar1.setRollover(true);
        oBar1.setPreferredSize(new java.awt.Dimension(100, 62));

        oLabel1.setText("  ");
        oBar1.add(oLabel1);

        oButton1.setFont(new java.awt.Font("Tahoma", 1, 14));
        oButton1.setText("1");
        oButton1.setFocusable(false);
        oButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton1.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton1.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton1.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton1.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton1ActionPerformed(evt);
            }

            private void oButton1ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar1.add(oButton1);

        oLabel2.setText("  ");
        oBar1.add(oLabel2);

        oButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); 
        oButton2.setText("2");
        oButton2.setFocusable(false);
        oButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton2.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton2.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton2.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton2.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton2ActionPerformed(evt);
            }

            private void oButton2ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar1.add(oButton2);

        oLabel3.setText("  ");
        oBar1.add(oLabel3);

        oButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); 
        oButton3.setText("3");
        oButton3.setFocusable(false);
        oButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton3.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton3.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton3.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton3.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton3ActionPerformed(evt);
            }

            private void oButton3ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar1.add(oButton3);
        oJPanelNumerico.add(oBar1, java.awt.BorderLayout.PAGE_START);

        // ToolBar_02
        
        oJPanelCentro.setMinimumSize(new java.awt.Dimension(100, 124));
        oJPanelCentro.setPreferredSize(new java.awt.Dimension(323, 124));
        oJPanelCentro.setRequestFocusEnabled(false);
        oJPanelCentro.setLayout(new java.awt.BorderLayout());

        oBar2.setFloatable(false);
        oBar2.setRollover(true);
        oBar2.setMaximumSize(new java.awt.Dimension(100, 62));
        oBar2.setMinimumSize(new java.awt.Dimension(100, 62));
        oBar2.setPreferredSize(new java.awt.Dimension(100, 62));

        oLabel4.setText("  ");
        oBar2.add(oLabel4);

        oButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton4.setText("4");
        oButton4.setFocusable(false);
        oButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton4.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton4.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton4.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton4.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton4ActionPerformed(evt);
            }

            private void oButton4ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar2.add(oButton4);

        oLabel5.setText("  ");
        oBar2.add(oLabel5);

        oButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton5.setText("5");
        oButton5.setFocusable(false);
        oButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton5.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton5.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton5.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton5.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCincoActionPerformed(evt);
            }

            private void btnCincoActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar2.add(oButton5);

        oLabel6.setText("  ");
        oBar2.add(oLabel6);

        oButton6.setFont(new java.awt.Font("Tahoma", 1, 14)); 
        oButton6.setText("6");
        oButton6.setFocusable(false);
        oButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton6.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton6.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton6.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton6.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton6ActionPerformed(evt);
            }

            private void oButton6ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar2.add(oButton6);
        
        // oLabel7.setText("  ");
        // oBar3.add(oLabel7);

        oJPanelCentro.add(oBar3, java.awt.BorderLayout.PAGE_START);

        oBar3.setFloatable(false);
        oBar3.setRollover(true);
        oBar3.setMinimumSize(new java.awt.Dimension(100, 62));
        oBar3.setPreferredSize(new java.awt.Dimension(100, 62));

        oLabel7.setText("  ");
        oBar3.add(oLabel7);

        oButton7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton7.setText("7");
        oButton7.setFocusable(false);
        oButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton7.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton7.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton7.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton7.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton7ActionPerformed(evt);
            }

            private void oButton7ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar3.add(oButton7);

        oLabel8.setText("  ");
        oBar3.add(oLabel8);

        oButton8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton8.setText("8");
        oButton8.setFocusable(false);
        oButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton8.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton8.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton8.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton8.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton8ActionPerformed(evt);
            }

            private void oButton8ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar3.add(oButton8);

        oLabel8.setText("  ");
        oBar3.add(oLabel8);

        oButton9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton9.setText("9");
        oButton9.setFocusable(false);
        oButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton9.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton9.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton9.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton9.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton9ActionPerformed(evt);
            }

            private void oButton9ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar3.add(oButton9);
        oJPanelCentro.add(oBar3, java.awt.BorderLayout.CENTER);
        oJPanelNumerico.add(oJPanelCentro, java.awt.BorderLayout.CENTER);
        
        oBar4.setFloatable(false);
        oBar4.setRollover(true);
        oBar4.setMinimumSize(new java.awt.Dimension(100, 62));
        oBar4.setPreferredSize(new java.awt.Dimension(100, 62));

        oLabel0.setText("  ");
        oBar4.add(oLabel0);

        oButton0.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButton0.setText("0");
        oButton0.setFocusable(false);
        oButton0.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButton0.setMaximumSize(new java.awt.Dimension(60, 60));
        oButton0.setMinimumSize(new java.awt.Dimension(60, 60));
        oButton0.setPreferredSize(new java.awt.Dimension(60, 60));
        oButton0.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButton0.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButton0ActionPerformed(evt);
            }

            private void oButton0ActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar4.add(oButton0);
        
        // COMA
        oLabel0.setText("  ");
        oBar4.add(oLabel0);

        oButtonComa.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        oButtonComa.setText(",");
        oButtonComa.setFocusable(false);
        oButtonComa.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButtonComa.setMaximumSize(new java.awt.Dimension(60, 60));
        oButtonComa.setMinimumSize(new java.awt.Dimension(60, 60));
        oButtonComa.setPreferredSize(new java.awt.Dimension(60, 60));
        oButtonComa.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButtonComa.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButtonComaActionPerformed(evt);
            }

            private void oButtonComaActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar4.add(oButtonComa);
        
        // CERRAR
        oLabel0.setText("  ");
        oBar4.add(oLabel0);

        oButtonCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/add.png"))); // NOI18N
        oButtonCerrar.setFocusable(false);
        oButtonCerrar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        oButtonCerrar.setMaximumSize(new java.awt.Dimension(60, 60));
        oButtonCerrar.setMinimumSize(new java.awt.Dimension(60, 60));
        oButtonCerrar.setPreferredSize(new java.awt.Dimension(60, 60));
        oButtonCerrar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        oButtonCerrar.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oButtonCerrarActionPerformed(evt);
            }

            private void oButtonCerrarActionPerformed(ActionEvent evt) {
                throw new UnsupportedOperationException("Not yet implemented");
            }
        });
        oBar4.add(oButtonCerrar);
        oJPanelNumerico.add(oBar4, java.awt.BorderLayout.PAGE_END);     
        
    }
    
    JPanel oJPanel= new JPanel();
    JPanel oJPanelCentro= new JPanel();
    JPanel oJPanelNumerico= new JPanel();
    JToolBar oBar1= new JToolBar();
    JToolBar oBar2= new JToolBar();
    JToolBar oBar3= new JToolBar();
    JToolBar oBar4= new JToolBar();
    JButton oButton1= new JButton();
    JButton oButton2= new JButton();
    JButton oButton3= new JButton();
    JButton oButton4= new JButton();
    JButton oButton5= new JButton();
    JButton oButton6= new JButton();
    JButton oButton7= new JButton();
    JButton oButton8= new JButton();
    JButton oButton9= new JButton();
    JButton oButton0= new JButton();
    JButton oButtonComa= new JButton();
    JButton oButtonCerrar= new JButton();
    JLabel oLabel1= new JLabel();
    JLabel oLabel2= new JLabel();
    JLabel oLabel3= new JLabel();
    JLabel oLabel4= new JLabel();
    JLabel oLabel5= new JLabel();
    JLabel oLabel6= new JLabel();
    JLabel oLabel7= new JLabel();
    JLabel oLabel8= new JLabel();
    JLabel oLabel9= new JLabel();
    JLabel oLabel0= new JLabel();
    JLabel oLabelComa= new JLabel();
    JLabel oLabelEspacio= new JLabel();
}
